import requests


url = "http://192.168.65.1:8000/api/user/login"
cs2 = {
    "userName": "admin",
    "password": "123456",
    "remember": False
}
r = requests.post(url, json=cs2)
print(r.json())
assert r.json()['message'] == '成功'
assert r.json()['code'] == 1
print(r.cookies) # <RequestsCookieJar>
for cookie in r.cookies: # <Cookie>
    print(cookie)
# RequestCookieJar 转成字典
cookies = requests.utils.dict_from_cookiejar(r.cookies)
print(cookies)

# 查询学科
url = "http://192.168.65.1:8000/api/admin/education/subject/page"
cs = {"level": None, "pageIndex": 1, "pageSize": 10}
r = requests.post(url, json=cs, cookies=cookies)
print(r.text)
assert r.json()['message'] == '成功'
assert r.json()['code'] == 1